# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-pem
pkgname=('python2-pem' 'python-pem')
_pkgname=pem
pkgver=23.1.0
pkgrel=3
pkgdesc='Easy PEM file parsing in Python.'
arch=('any')
url='https://pypi.org/project/pem/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('e742dba55df69736ed5896370da980b25961682a9fd38b6940490cb82332813fc1d7a931fe651716fa31caf6080e6fb047d0ef62d3e61d7e3e1288a00b70051e')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-pem() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build
}

package_python-pem() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build
}

